home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 19
/
Aminet 19 (1997)(GTI - Schatztruhe)[!][Jun 1997].iso
/
Aminet
/
comm
/
maxs
/
dfbv13.lha
/
dfb
/
Developers
/
dfb.doc
< prev
next >
Wrap
Text File
|
1980-01-15
|
46KB
|
1,264 lines
TABLE OF CONTENTS
dfb.library/OpenFileBase
dfb.library/CloseFileBase
dfb.library/ReadNextFile
dfb.library/ReadLastFile
dfb.library/AddFile
dfb.library/ModifyFile
dfb.library/PurgeFileBase
dfb.library/ConvertTime
dfb.library/FixTime
dfb.library/GetFileList
dfb.library/GetFileIDDiz
dfb.library/LoadMarkedList
dfb.library/SaveMarkedList
dfb.library/AddMarkedList
dfb.library/SubMarkedList
dfb.library/DisplayNode
dfb.library/FixName
dfb.library/DateToAscii
dfb.library/TimeToAscii
dfb.library/GetFileDir
dfb.library/FindFile
dfb.library/IsMarked
dfb.library/ Reserved
dfb.library/Decrement
dfb.library/AsciiToDate
dfb.library/AsciiToTime
dfb.library/LoadPrefs
dfb.library/AddSection
dfb.library/SavePrefs
dfb.library/AddUser
dfb.library/GetUser
dfb.library/SaveUser
dfb.library/ Reserved
dfb.library/ Reserved
dfb.library/OnUpload
dfb.library/ Reserved
dfb.library/GetFilePaths
dfb.library/ Reserved
dfb.library/ Reserved
dfb.library/EditFile
dfb.library/StealMaxsDevice
dfb.library/ReleaseMaxsDevice
dfb.library/ReceiveFiles
dfb.library/SendFiles
dfb.library/GetMarkedListNext
dfb.library/ Reserved
dfb.library/ Reserved
dfb.library/OpenFileBase dfb.library/OpenFileBase
NAME
OpenFileBase -- Opens file base and loads preferences
SYNOPSIS
handle = OpenFileBase(type, datafile);
D0 D0 A1
struct dfbFileBase *OpenFileBase(int type, char *DataFile);
FUNCTION
Opens the file dfb:dfb.data and loads a copy of the preferences file
dfb:dfb.prefs into memory. This function is used when you need to
read, write or modify the file base. If there is no file base this
routine will create it for you.
INPUTS
type -
ATSTART - This will open the file base positioned at the start
I.e Before the first file.
ATEND - This will open the file base positioned at the end
I.e After the last file.
STARTLOCK - This will open the file base at the start with an
exclusive DOS lock. Programmes should not require this.
Keep A1 null. In future versions of DFB (probably 1.3) this will
be the data file's name to load in.
RESULT
handle - pointer to the handle structure, or NULL if failure.
SEE ALSO
CloseFileBase()
dfb.library/CloseFileBase dfb.library/CloseFileBase
NAME
CloseFileBase -- Closes the file base and frees memory
SYNOPSIS
CloseFileBase(handle);
d1
VOID CloseFileBase(struct dfbFileBase *Handle);
FUNCTION
Closes the file base opened from OpenFileBase. Frees memory taken
from OpenFileBase.
INPUTS
handle which we got when we opened the file base with OpenFileBase.
dfb.library/ReadNextFile dfb.library/ReadNextFile
NAME
ReadNextFile -- Reads in the next file in the file base
SYNOPSIS
ok = ReadNextFile(free memory, handle structure, mode);
D0 A0 D0 D1
int = ReadNextFile(char *memory, struct dfbFileBase *Handle, int mode);
FUNCTION
Reads in the next file node in the file base into the memory specified
by A0. Before calling this function you need to find out how much
memory the next file node will occupy. This value is stored in the
handle structure at OF_NEXTLENGTH.
The memory specified by A0 will first be filled with the file node
structure (this contains pointers to file name, file description etc,
and it also contains all the other relavent information). After the
file node structure the remaining memory will be filled with the
file name, uploader, uploader's alias and file description.
N.B: You should always ignore files marked with the ASTALAVISTA flag in
the of_status byte. These files have either been zotted by a sysop
or have been moved to the end of the file base (see modify file).
(V1.01+ or dfb.library has detected a corrupted area in the file base and
skips the file(s))
If d0 is non zero an error occured.
INPUTS
free memory - free memory which will be filled with the file node and
information. The size should be at least the size of
OF_NEXTLENGTH.
handle structure - The pointer to the handle structure you got when you
called OpenFileBase.
mode - Keep this value clear.
There is a QUICKMODE which enables you
to read in the file node structure in internal format.
Programmers should not use this mode.
SEE ALSO
OpenFileBase(), ReadLastFile()
dfb.library/ReadLastFile dfb.library/ReadLastFile
NAME
ReadLastFile -- Reads in the last file in the file base
SYNOPSIS
ok = ReadLastFile(free memory, handle structure, mode)
D0 A0 D0 D1
int = ReadLastFile(char *memory, struct dfbFileBase *Handle, int mode)
FUNCTION
Reads in the last file node in the file base into the memory specified
by A0. Before calling this function you need to find out how much
memory the next file node will occupy. This value is stored in the
handle structure at OF_LENGTH.
The memory specified by A0 will first be filled with the file node
structure (this contains pointers to file name, file description etc,
and it also contains all the other relavent information). After the
file node structure the remaining memory will be filled with the
file name, uploader, uploader's alias and file description.
N.B: You should always ignore files marked with the ASTALAVISTA flag in
the of_status byte. These files have either been zotted by a sysop
or have been moved to the end of the file base (see modify file).
If d0 is non zero an error occured.
INPUTS
free memory - free memory which will be filled with the file node and
information. The size should be at least the size of
OF_LENGTH.
handle structure - The pointer to the handle structure you got when you
called OpenFileBase.
mode - Keep this value clear.
There is a QUICKMODE which enables you
to read in the file node structure in internal format.
Programmers should not need this mode.
SEE ALSO
OpenFileBase(), ReadNextFile()
dfb.library/AddFile dfb.library/AddFile
NAME
AddFile -- Adds a file to the file base.
SYNOPSIS
ok = AddFile( handle structure, file node structure,);
D0 D0 A0
LONG = AddFile(struct dfbFileBase *Handle, struct dfbFile *File);
FUNCTION
Adds in a file node to the file base, incrememnts the number of files in
the file base. Before you use this command you must call OpenFileBase
first to get the handle structure, n.b: you shouldn't open the file
base first with exclusive lock - just open it up as you usually would.
If there was an error D0 will return non-zero.
INPUTS
file node structure - The pointers to the strings: uploader, uploader's
alias, file name and description must be set. Or zero
if not present. The field FB_LENGTH does not need to
be set. AddFile will work this out for you.
handle structure - What you got after calling OpenFileBase
SEE ALSO
OpenFileBase()
dfb.library/ModifyFile dfb.library/ModifyFile
NAME
ModifyFile -- Modifies a file in the file base.
SYNOPSIS
ok = ModifyFile(file node structure, handle structure);
A0 D0
int = ModifyFile(struct dfbFile *File, struct dfbFileBase *Handle);
FUNCTION
This command modifies the next file in the file base. E.g: If you have
just opened the file base at the start, read the first node in and
called this function, the second file node will be modified.
For example, if you have just read in a file node with ReadNextFile and
want to modify that file, before you call this command you will need to
call ReadLastFile to get back to it then call this function.
N.B: If you were reading the files backwards, e.g: you opened the file
base at the end and called ReadLastFile and you wish to modify that file
node then you can call ModifyFile straight after and it will modify the
correct file.
Since DFB is dynamic if you edit a file and give it say a longer
description it may not be able to fit into its current position
so what DFB does is mark the old position with a ASTALAVISTA flag which
tells ReadDFB to ignore that node. (you should always skip files marked
with ASTALAVISTA.) It will then append the new file node to the end of
the file base.
NOTES
If you modify a file to be ASTALAVISTA you *MUST* decrement the number
of files in the file base, to do this call Decrement().
Never clear the bit ASTALAVISTA if it has already been set.
INPUTS
File node structure - A pointer to the new file node structure which
should overwrite the old one. N.B: The FB_LENGTH field
need not be correct since ModifyFile works it out for you.
SEE ALSO
OpenFileBase(), Decrement()
dfb.library/PurgeFileBase dfb.library/PurgeFileBase
NAME
PurgeFileBase - Optimizes file base, can delete files marked for deletion
Removes all file nodes marked with ASTALAVISTA.
SYNOPSIS
ok = PurgeFileBase();
D0
LONG = PurgeFileBase(VOID);
FUNCTION
PurgeFileBase performs some very basic housekeeping functions (it is
not the file manager), such as deleting files marked with deleted
(if the bit pfb_delonpurge is set in the file preferences)
and also removing all file nodes marked with ASTALAVISTA and/or DELETED.
PurgeFileBase creates a temporary file base in memory so if your
file base is 500K you should have at least that memory free in ram.
This function should not be called if any other programme currently
has the file base opened.
N.B: This routine can take several minutes to run so do not use it lightly.
If D0 is non zero an error occured.
dfb.library/ConvertTime dfb.library/ConvertTime
NAME
ConvertTime - converts from Amiga DateStamp time to something useful.
SYNOPSIS
minute, hour, day, month, year = ConvertTime(days, mins);
D0 D1 D2 D3 D4 D0 D1
FUNCTION
Converts from 'amiga' time to something useful. I think a similar
(and probably) better function is available in utilities.library but
at the time of writing this function I didn't know about it so this is
the one DFB uses.
D0 - returns the number of minutes past the hour,
D1 - the number of hours past the start of the day
D2 - the day number of the month
D3 - the month of the year
D4 - the year of the file
INPUTS
D0 - ds_days from DateStamp
D1 - ds_minutes from DateStamp
SEE ALSO
FixTime(), TimeToAscii(), DateToAscii()
dfb.library/FixTime dfb.library/FixTime
NAME
FixTime - Puts the current time into a file node.
SYNOPSIS
FixTime (file node structure);
A0
VOID = FixTime (struct File *);
FUNCTION
Calls DateStamp from dos.library to get the current time, it then
calls ConvertTime from dfb.library to convert the time to a useful
format. It then places the min, hour, day, month and year into
fb_min, fb_hour, fb_day etc.
INPUTS
file node structure - pointer to file node structure which you wish
to have the time updated.
SEE ALSO
ConvertTime()
dfb.library/GetFileList dfb.library/GetFileList
NAME
GetFileList - executes the command in the third column of DFBArchivers.
SYNOPSIS
ok = GetFileList(path and filename, preferences);
D0 A0 A1
LONG = GetFileList(STRPTR *, struct preferences *);
FUNCTION
When this function is called, GetFileList will first examine the
extension of the filename. (E.g .lha, .lzh etc), it will then locate the
correct row and then it will execute the command found in the third
box on that row. Replacing the '<>' with the path and filename given.
This function is generally used by ReadDFB to view files online, so
the result of this function call will typically create a file in ram:
called 'ListX' which may be, say the file list in an archive.
If D0=0 the file ListX was created ok.
If D0=-1 the file had a text extension (so read the file directly)
If D0=-2 the file did not have an extension given in the preference file.
INPUTS
path and filename - a pointer to the file name (including full path)
which you wish to use.
preferences - a pointer to a copy of DFB's preferences, this can be got
by a call to either LoadPrefs or OpenFileBase the later
having a pointer to preferences in the handle structure
at OF_PREFERNCES.)
SEE ALSO
GetFileIDDiz(), OnUpload()
dfb.library/GetFileIDDiz dfb.library/GetFileIDDiz
NAME
GetFileIDDiz - extracts a file_id.diz from a file.
SYNOPSIS
description, length = GetFileIDDiz(path and filename, preferences);
A0 D0 A0 A1
STRPTR *, ULONG = GetFileIDDiz(STRPTR *, struct preferences *)
FUNCTION
When this function is called DFB will extract the file_id.diz from the
file given. The file, file_id.diz, will be created in the current
directory. It will then be read, a pointer to it is given in A0 and the
length in D0. The file_id.diz will then be deleted.
If D0=0 there was no file_id.diz
If D0=-1 then an error occured, else D0 equals length of the file
file_id.diz which is loaded.
N.B: You must free the memory once you have finished with it
E.g:
move.l dfbhandle,a5 ;handle received from OpenFileBase
lea filename,a0
move.l of_preferences(a5),a1 ;get preferences
CALLDFB GetFileIDDiz
tst.l d0 ;file_id.diz exist?
beq nodiz
cmp.l #-1,d0 ;error?
beq nodiz
move.l a0,a5 ;remember address & size
move.l d0,d5
; use the file_id.diz
move.l a5,a1 ;free file_id.diz from memory
move.l d5,d0
CALLEXEC FreeMem
nodiz rts
filename
dc.b 'hd1:bbs/newfiles/ademo.dms',0
INPUTS
path and filename - a pointer to the file name (including full path)
which you wish to use.
preferences - a pointer to a copy of DFB's preferences, this can be got
by a call to either LoadPrefs or OpenFileBase the later
having a pointer to preferences in the handle structure
at OF_PREFERNCES.)
SEE ALSO
GetFileList(), OnUpload()
dfb.library/LoadMarkedList dfb.library/LoadMarkedList
NAME
LoadMarkedList - loads the user's marked (tagged) files.
SYNOPSIS
marked list, current length = LoadMarkedList(user's name);
A0 D0 A0
STRPTR *, ULONG = LoadMarkedList(STRPTR *);
FUNCTION
This function is used to load a copy of the user's currently marked files,
in essence this function gets the user's name, converts it to a dos
format, adds in dfbtag:dfbml. and then loads it into memory, A0 points to
the marked list and D0 is the size of it.
E.g:
If the user was say Andrew Leppard this function would open the file:
DFBTag:DFBML.Andrew_Leppard
The marked list is a null terminated text file with $0a's after each file
name. The file names are always lower case to help in file name
matching. When loading the marked list this function will convert all
names to lower case for you.
INPUTS
user's name: A string pointer to the user's name.
SEE ALSO
SaveMarkedList(), AddMarkedList(), SubMarkedList(), IsMarked(),
GetMarkedListNext()
dfb.library/SaveMarkedList dfb.library/SaveMarkedList
NAME
SaveMarkedList - saves the user's marked (tagged) files.
SYNOPSIS
SaveMarkedList(user's name, marked list, final size);
A0 A1 D0
VOID = SaveMarkedList(STRPTR *, ULONG, ULONG);
FUNCTION
Saves a copy of the user's marked list to a text file, A1 is a pointer
to null terminated text, where each file is seperated by a $0A
character. D0 is the length of this text. If there are no marked files
in the marked file list, SaveMarkedList will delete the file on disk.
INPUTS
user's name: a pointer to a string of the user's name whom you wish
to save his/r marked files
marked list: pointer to the marked files
final size: current (or final) size of marked file list
SEE ALSO
LoadMarkedList(), AddMarkedList(), SubMarkedList(), IsMarked(),
GetMarkedListNext()
dfb.library/AddMarkedList dfb.library/AddMarkedList
NAME
AddMarkedList - adds a file to the user's marked list
SYNOPSIS
sucess, newsize = AddMarkedList(Marked list, Name to add, Current Size);
D0 D1 A0 A1 D0
ULONG, ULONG = AddMarkedList(ULONG, STRPTR *, ULONG);
FUNCTION
Adds a file to the marked file list, first it checks whether the file
will fit (the marked file list has a maximum size of 1K for file names),
if not D0 returns a -1 else null. It then converts the file's name to
lower case then adds it to the end of the marked list. The new size of
the marked file list is then calculated and returned.
INPUTS
marked list - pointer to the marked file list
name to add - the file name to add
current size - the current size of the marked list
SEE ALSO
SaveMarkedList(), LoadMarkedList(), SubMarkedList(), IsMarked(),
GetMarkedListNext()
dfb.library/SubMarkedList dfb.library/SubMarkedList
NAME
SubMarkedList - removes a file from the user's marked list
SYNOPSIS
sucess, newsize = SubMarkedList(Marked list, Name to sub, Current Size);
D0 D1 A0 A1 D0
FUNCTION
Removes a file from the marked list, if the file is not found in the
marked list a -1 will be returned in D0 else null. The new size of the
list will be returned in D1.
INPUTS
marked list - pointer to the marked file list
name to sub - the file name to remove
current size - the current size of the marked list
SEE ALSO
SaveMarkedList(), LoadMarkedList(), AddMarkedList(), IsMarked(),
GetMarkedListNext()
dfb.library/DisplayNode dfb.library/DisplayNode
NAME
DisplayNode - converts a file node structure to ready-to-display ansi
SYNOPSIS
ptr to lines, spaces for name, name offset =
A0 D0 D1
DisplayNode(file node structure, free space, marked list, file handle
A0 A1 A2 A3
structure, compressed data structure, marked list size, name offset,
A4 D0 D1
early stop mask, user access)
D2 D3
FUNCTION
I'll be the first to admit this function is extremly messy, in a
future version of the library there will be an easier way of calling
this function. The reason it's included here is because it is
_extremly_ powerful. This is the main basis for ReadDFB, this function
handles almost ALL of the file display. It takes into account file
layouts, highlighted files, files with shifted names and the access of
the user viewing the files.
DisplayNode consults the compressed data (if given) to work out how to
display the file, it then systematically constructs an ansi text
display of the file, performing all the messy hex->ascii and date->ascii
conversions.
It then returns in A0 a list of all the ansi lines, null terminated and
ready to display. The list is a simple null terminated list of addresses,
each longword being a pointer to a text line.
Sometimes the name can not fit in the display ansi so DFB returns how
many characters of the name was displayed in D0.
N.B: Only one list from DisplayNode can be kept at any one time, if you
call this function again the original list will be changed. Infact it
is recommended to use this list immediately since any future calls by
your process to dfb.library may change it.
INPUTS
file node structure - a pointer to the file node you wish to display
free space - allow at least 1Kb for the display ansi
marked list - a pointer to the marked list if you want marked
files to be highlighted. If not point to a null
byte and set marked list size to 0.
file handle structure - a pointer to the file handle you got with
OpenFileBase()
compressed data structure - a pointer to the compressed (layout) data you
wish to use. If you wish to use the default you
may set this to 0.
marked list size - length of the marked list, if you do not wish to
use a marked list set this to 0.
name offset - In ReadDFB the name can be scrolled left and right
with the arrow keys. This allows the name to be
shifted.
early stop mask - You can tell DisplayNode to stop when it reaches a
certain point. Currently only: AFB_STATUS is
supported which means stop after displaying file
status (e.g: offline etc). Set to null if you want
all of the file displayed.
user access - Like in ReadDFB users' see more information if they
have higher access. So put in the user's access you
wish to emulate here. N.B: DisplayNode does _NOT_
check whether the user has access to see this file
or not.
SEE ALSO
FixName()
dfb.library/FixName dfb.library/FixName
NAME
FixName - Performs DisplayNode but _only_ on file name
SYNOPSIS
pointer to line = FixName(file node structure, free space, marked list,
A0 A0 A1 A2
file handle structure, size of marked list, name offset, name size);
A3 D0 D1 D2
FUNCTION
In ReadDFB, displaying the name of the file has many complications,
this function handles all of them, being: Space for name,
highlighting (marked), offset. It returns a pointer to the one ansi
line for the new display.
This function does _NOT_ take into account compressed (layout) data, it
assumes that the name is followed directly by the status and that the
name is at the beginning of the line. This function will become
obsolete so it is not recommened you use it. Rather, call DisplayNode()
if you need to fix up the name.
Again A0 returns a pointer to the first line. (Which will always be
a pointer to the free space given).
INPUTS
file node structure - the file whose name you wish to display
free space - free memory to hold name, 100 bytes should be enough
marked list - pointer to marked list, if no marked list point to
a null byte.
file handle structure
- structure you got from OpenFileBase()
size of marked list - Size of marked list, null if no list
name offset - Start printing name at this letter...
name size - Space available for name
SEE ALSO
DisplayNode()
dfb.library/DateToAscii dfb.library/DateToAscii
NAME
DateToAscii - Converts date in DFB format to an ascii string
SYNOPSIS
DateToAscii(buffer, day, month, year);
A0 D0 D1 D2
VOID = DateToAscii(STRPTR *, UBYTE, UBYTE, UWORD);
FUNCTION
Converts a date in the format of day, month & year to null terminated
ascii text in the format: dd/mmm/yyyy: E.g: 12/May/1994.
INPUTS
Buffer - a text buffer to store the date in, allow at least 12 bytes.
day - the day, 1->31.
month - the month, 1->12.
year - the year 0->9999.
SEE ALSO
ConvertTime(), TimeToAscii(), AsciiToTime(), AsciiToDate()
dfb.library/TimeToAscii dfb.library/TimeToAscii
NAME
TimeToAscii - Converts time in DFB format to an ascii string
SYNOPSIS
TimeToAscii(buffer, min, hour, format);
A0 D0 D1 D2
VOID = TimeToAscii(STRPTR *, UBYTE, UBYTE, UBYTE);
FUNCTION
Converts time in the format, minute and hour to a null terminating
ascii string. E.g: 12:15am.
INPUTS
buffer - a text buffer to store the time in, allow at least 8 bytes.
min - the minute past the hour
hour - the hour in the day
format - either 12 or 24. (12 hour time adds 'am' or 'pm')
SEE ALSO
ConvertTime(), DateToAscii(), AsciiToTime(), AsciiToDate()
dfb.library/GetFileDir dfb.library/GetFileDir
NAME
GetFileDir - Gets file's full directory path from name.
SYNOPSIS
path = GetFileDir(file name, free memory);
A0 A0 D0
char *GetFileDir(char *filename, char *freememory);
FUNCTION
First it will check whether another process has already loaded the path
names and if it has it will share the data with it.
Using the file name given, searches all of MAXs file paths (including
file path, 40 optional file paths and the paths listed in the text
file filepaths.text) to get the file's full directory path.
E.g: if the file to search for was demofile.dms and the file paths were:
hd1:filepath/
hd2:newfiles/newfile/
hd3:oldfiles/
This function would try to get locks on the following files:
hd1:filepath/demofile.dms
hd2:newfiles/newfile/demofile.dms
hd3:oldfiles/demofile.dms
Until a sucessful lock was found, indicating which path the file was in.
If this function is succesful (i.e: the file is found) then A0 will
point to the free memory given (which should be at least 124 bytes long)
else it will be null. The free memory will have a null terminating
string containing the file's full path and name.
INPUTS
name - the name of the file to be found (with *NO* directory information)
free memory - at least 124 bytes to store full path
dfb.library/FindFile dfb.library/FindFile
NAME
FindFile - Get a file's node structure from a file name
SYNOPSIS
file node, position = FindFile(options, file name, datafile);
A0 D1 D0 A0 A1
struct dfbFile *FindFile(int options, char *filename, char *datafile);
FUNCTION
Performs a very quick search through dfb:dfb.data to find the node
structure which contains the file name. This function is much quicker
than doing a series of ReadNextFile()'s and checking the names by hand.
INPUTS
A0 - a pointer to the file name to search for, case is unimportant.
D0 - find file options, FF_POS will also return the file's position in
the file base in D1.
A1 - Keep this NULL. In future versions of dfb (probably v1.3) this will
be the data file (dfb.data) to load.
dfb.library/IsMarked dfb.library/IsMarked
NAME
IsMarked - determine if a file has been marked (tagged)
SYNOPSIS
tagged = IsMarked(marked list, file name, marked list size);
D0 A0 A1 D0
int = IsMarked(char *list, char *filename, int listsize);
FUNCTION
Searches the marked file list for the file name given in A1, returns a
1 if the file was found or a 0 if the file is not in the list.
INPUTS
A0 - Pointer to the marked file list
A1 - Null terminating string containing the file name to search for,
case unimportant
D0 - Size of the marked file list
SEE ALSO
LoadMarkedList(), SaveMarkedList(), AddMarkedList(), SubMarkedList()
dfb.library/Decrement dfb.library/Decrement
NAME
Decrement - decrements the number of files in the file base by 1
SYNOPSIS
Decrement(handle structure);
A0
VOID = Decrement (struct dfbFileBase *handle);
FUNCTION
Modifies the internal file count in dfb.data. This function first reads
from dfb.data to determine the file number, then decrements this count
by 1 (If number of files is greater than zero). This function will then
change OF_FILES accordingly in the handle structure.
This function should _ONLY_ be called after making a call to ModifyFile()
when you change a file's status to ASTALAVISTA.
INPUT
A0 - the handle structure you got from OpenFileBase()
SEE ALSO
Increment() (Not public yet)
dfb.library/AsciiToDate dfb.library/AsciiToDate
NAME
AsciiToDate - converts ascii text string to dfb date data
SYNOPSIS
day month year = AsciiToDate(date);
D0 D1 D2 A0
FUNCTION
Converts a date of the form:
dd/mmm/yy
to the hex numbers for the day of the week, month of the year and the
year.
E.g:
12/Jan/95
Would makae D0=12, D1=1, D2=1995
INPUT
A0 - A pointer to a null terminated text string in the form of the date
above
SEE ALSO
ConvertTime(), DateToAscii(), TimeToAscii(), AsciiToTime()
dfb.library/AsciiToTime dfb.library/AsciiToTime
NAME
AsciiToTime - converts a null terminated ascii string to dfb time data
SYNOPSIS
hours mins = AsciiToTime(time);
D0 D1 A0
FUNCTION
Converts time in the form:
hh:mm ?m
to the hex number for hours in the day, minutes past the hour.
E.g:
12:30am
Would make: D0=12, D1=30
INPUT
A0 - pointer to null terminated ascii string with time
SEE ALSO
ConvertTime(), DateToAscii(), DateToAscii(), AsciiToTime()
dfb.library/LoadPrefs dfb.library/LoadPrefs
NAME
LoadPrefs - loads a copy of dfb preferences into memory
SYNOPSIS
preferences = LoadPrefs (prefs file);
A0 A0
struct preferences = LoadPrefs(STRPTR *);
FUNCTION
This functions loads the file dfbprefs:dfb.prefs into memory, it also
fixes the pointers in the structure also fills the vector pf_length.
I.e: pf_length, pf_sections, se_nextsection(s) are corrected.
This function is automatically called when the OpenFileBase() function
is called and as a result the structure returned from OpenFileBase() has
a pointer to dfb preferences.
Remember to free the memory taken by the preferences when finished. The
length is given in pf_length.
If no preferences file is found this will load a copy of the default
settings.
INPUTS
A0 - the name of the preference file you wish to load. If you are using
the default preferences file set this to 0.
SEE ALSO
SavePrefs(), AddSection()
dfb.library/AddSection dfb.library/AddSection
NAME
AddSection - adds a file section to dfb. (the preferences file)
SYNOPSIS
sucess = AddSection(prefs file, section);
D0 A0 A1
ULONG = AddSection(STRPTR *, struct section *);
FUNCTION
This function appends a copy of the section given to the end of the
preferences file. The section *must* be initialized correctly,
i.e: all ascii strings null terminating, section number shouldn't be
greater than 65,000 etc.
If D0=0 then this function was successful.
INPUTS
A0 - A pointer to the preferences file you wish to add the section too.
If you wish to add it to the default set A0=0.
A1 - Pointer to an initialized section to add.
SEE ALSO
LoadPrefs(), SavePrefs()
dfb.library/SavePrefs dfb.library/SavePrefs
NAME
SavePrefs - saves your copy of dfb preferences
SYNOPSIS
sucess = SavePrefs(preferences file, preferences, freememory?, anaylse links?)
D0 A0 A1 D0 D1
ULONG = SavePrefs(STRPTR *, struct preferences *, ULONG, ULONG);
FUNCTION
Saves your copy of the preferences over the old copy, this function
handles all the necessary work.
If D0 is not equal to zero then an error occured
INPUTS
A0 - The preferences file you wish to overwrite, zero if you want to
save over the default preferences file.
A1 - A pointer to the preferences
D0 - Free the memory used by the preferences? 1=yes
D1 - Analyse links? i.e traverse section data going from section to
section and not believing pf_length as a guide to preferences length
SEE ALSO
LoadPrefs(), AddSection()
dfb.library/AddUser dfb.library/AddUser
NAME
AddUser - adds a user to dfb's user base
SYNOPSIS
sucess = AddUser(file, user);
D0 A0 A1
ULONG = AddUser(STRPTR *, struct user);
FUNCTION
This adds a user to dfb's userbase (usually kept in dfbusers:dfb.user)
other than that this function does not do anything special.
If D0 is not equal to zero then an error occured.
INPUTS
A0 - The user base you wish to add a user to, if zero then add it to
default user base file (dfbusers:dfb.user)
A1 - A pointer to the user structure of the user you wish to add, this
must be properly initialized.
SEE ALSO
GetUser(), SaveUser()
dfb.library/GetUser dfb.library/GetUser
NAME
GetUser - Loads a user from the dfb.user file
SYNOPSIS
sucess new = GetUser(user file, free memory, user name, preferences, user #);
D0 D1 A0 A1 A2 A3 D0
ULONG ULONG = GetUser(STRPTR *, BPTR, STRPTR *, struct preferences *,
ULONG);
FUNCTION
This function loads a user from dfb's user file, there are two methods
of reading in a user:
1) Read the nth user of the user file.
2) Read in a user by the specified name.
If D0 (sucess) = -1 then this function did not work.
Method 1:
Clear A2 since we are loading the nth user. Set D0 to be the user number.
Set all other registers as specified in INPUT. If you load in the first
user (D0=1) this function will return the number of users in the user
base in D0.
Method 2:
Set A2 to point to the null terminated user name. Clear D0. Set all
other registers as specified in INPUT. If this function is sucessful
the user number of this user will be returned in D0. If the user was
not found DFB will attempt to create a user node. If DFB creates one
for you it will set D1=1 to indicate this user wasn't previously in the
user base. If you wish to keep that user you must call AddUser(). You
must retain the user number if you wish to save/modify this user.
INPUT
A0 - a pointer to the user base we wish to load a user from. If default
set this to null.
A1 - free memory to put the user node in. It should be length us_sizeof.
A2 - name of user - if we are looking for a user by name
A3 - pointer to the preferences
D0 - user number to load - if we are looking for the nth user
SEE ALSO
AddUser(), SaveUser()
dfb.library/SaveUser dfb.library/SaveUser
NAME
SaveUser - saves (modifies) a user to the user base (DOES NOT ADD!)
SYNOPSIS
sucess = SaveUser(user file, user, user number);
D0 A0 A1 D0
ULONG = SaveUser(STRPTR *, struct user *, ULONG);
FUNCTION
Saves a new user struct over an old one. This functions requies you
to specify which number the user is. You would have got this number
from the corresponding call to GetUser(). If Everything went ok then
D0=0.
N.B: This function does not add a user to the user base but merely
overwrites an old one. You can change the name of the user in the user
struct if you desire but you should be careful that another user hasn't
the same name. Since a call to GetUser will locate the first user with
the corresponding name.
INPUTS
A0 - The dfb.user file you wish to write to. Set this to zero for the
default file.
A1 - A pointer to a user structure you wish to write
D0 - The user number that was returned from GetUser()
SEE ALSO
AddUser(), GetUser()
dfb.library/OnUpload dfb.library/OnUpload
NAME
OnUpload - executes the command in the second column of DFBArchivers.
SYNOPSIS
ok = OnUpload(path and filename, preferences);
D0 A0 A1
ULONG = OnUpload(STRPTR *, struct preferences *);
FUNCTION
When this function is called, GetFileList will first examine the
extension of the filename. (E.g .lha, .lzh etc), it will then locate the
correct row and then it will execute the command found in the second
box on that row. Replacing the '<>' with the path and filename given.
This function is generally called by ReadDFB when the user has uploaded
a new file. Generally the command in the box is used to strip other
BBS adds or add in the BBS's add or whatever the user has specified.
INPUTS
path and filename - a pointer to the file name (including full path)
which you wish to use.
preferences - a pointer to a copy of DFB's preferences, this can be got
by a call to either LoadPrefs() or OpenFileBase() the later
having a pointer to preferences in the handle structure
at OF_PREFERNCES.)
SEE ALSO
GetFileList(), GetFileIDDiz()
dfb.library/GetFilePaths dfb.library/GetFilePaths
NAME
GetFilePaths -- Returns a pointer to a global read only structure which
contains all the file file paths used by MAXS / DFB. (V2)
SYNOPSIS
FilePaths = GetFilePaths();
A0
struct FilePaths *GetFilePaths();
FUNCTION
This function loads maxs bbs:maxsbbs.config and gets the file file path
and 40 optional file paths, it also loads the file FilePaths.text and
loads in all the file paths. If dfb.library already has a copy in
memory it will return a pointer.
DO NOT write to this. It is for global use only.
NB: V2 refers to the V1.2 release, V3 referes to the V1.3 release.
RESULTS
FilePaths - a pointer to a read only structure containing file path
pointers. NULL return means failure.
SEE ALSO
GetFileDir()
dfb.library/EditFile dfb.library/EditFile
NAME
EditFile -- loads up a GUI on the MAX's screen. (V3)
SYNOPSIS
Change = EditFile(filetoedit, handle, editedfile);
D0 A0 A1 A2
ULONG EditFile(struct dfbFile *, struct dfbFileBase *, struct dfbFile *);
FUNCTION
Loads up a GUI on the correct MAX's screen, this function will take
care of all file base modifications, it will take care of *everything*,
the finally edited file node will be filled into the editedfile structure.
This structure *MUST* be of MAX_NODE_SIZE.
INPUTS
filetoedit - a pointer to the original file node, this must be in
the dfbdata:dfb.data file. EditFile uses FindFile() to
search for the node's file name to modify the file
in the filebase.
handle - pointer to a file base structure
editedfile - empty structure to be filled in
RESULTS
Change - returns 1 if anything was changed.
dfb.library/StealMaxsDevice dfb.library/StealMaxsDevice
NAME
StealMaxsDevice -- Steals the device that MAX's is using. (V3)
SYNOPSIS
Success = StealMaxsDevice(IORequest, Node);
D0 A0 D0
ULONG StealMaxsDevice(struct IORequest *, UBYTE);
FUNCTION
This function 'steals' the serial.device or whatever device MAX's
is using and lets a door programme use it. It is inteded for door
programmes only. It enables the door programme to interact directly
with the serial device by using IOReqest type functions, e.g DoIO() etc.
You need to supply a IORequest structure to be initialised. Also the
node number you are using. This number is given in the command
line argument when your door is loaded.
This function needs MaxsPatch to be running.
To return control back to MAX'S BBS run ReleaseMaxsDevice()
It returns 0 if everything is ok or else DFB_ERR_MEM (no memory) or
DFB_ERR_PATCH (when patch is not running).
INPUTS
IORequest - empty request structure
Node - MAX's node, *NOT* 0.
RESULT
IORequest is filled in, Message/Reply port is created for you.
SEE ALSO
ReleaseMaxsDevice()
dfb.library/ReleaseMaxsDevice dfb.library/ReleaseMaxsDevice
NAME
ReleaseMaxsDevice -- Releases device taken by StealMaxsDevice(). (V3)
SYNOPSIS
ReleaseMaxsDevice(IORequest, Node);
A0 D0
void ReleaseMaxsDevice(struct IORequest *, UBYTE);
FUNCTION
This function releases control of the serial device back to MAX's BBS.
This function should be called before returning back to MAX's.
INPUTS
IORequest - empty request structure
Node - MAX's node, *NOT* 0
SEE ALSO
StealMaxsDevice()
dfb.library/GetMarkedListNext dfb.library/GetMarkedListNext
NAME
GetMarkedListNext -- Gets the next marked file in the marked list. (V3)
SYNOPSIS
new offset = GetMarkedListNext(marked list, offset, space for name);
D0 A0 D0 A1
int = GetMarkedListNext(char *list, int offset, char *name);
FUNCTION
This function is used to traverse a marked file list, successively
callings this function you can process each marked file.
Offset contains an offset from where to start reading the marked list,
when you first call this function set it to zero. Then replace
offset by new offset for sucessive calls. New offset will return
zero when there are no more files. The next marked file will be
copied to the pointer supplied in A0.
INPUTS
A0 - Pointer to the marked file list
D0 - Offset, set this to zero or the last value returned from
GetMarkedListNext
A1 - Buffer to place file name in
SEE ALSO
LoadMarkedList(), SaveMarkedList(), AddMarkedList(), SubMarkedList(),
IsMarked()